package com.hongyi.app.factory;

import com.hongyi.app.mapper.PermissionMapper;
import com.hongyi.app.mapper.RolePermissionMapper;
import com.hongyi.app.service.PermissionService;
import com.hongyi.app.service.impl.PermissionServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * @author HongYi
 */
@Slf4j
public class PermissionServiceFactory {

    public PermissionServiceFactory(){
        log.info("PermissionServiceFactory被实例化");
    }

    public PermissionService getInstance(PermissionMapper permissionMapper,
                                         RolePermissionMapper rolePermissionMapper){

        //手动IOC
        PermissionServiceImpl permissionService = new PermissionServiceImpl();

        //手动DI
        permissionService.setPermissionMapper(permissionMapper);
        permissionService.setRolePermissionMapper(rolePermissionMapper);

        return permissionService;
    }
}
